package com.pinoc.demo.controller.es;

import com.pinoc.demo.service.es.EsOperateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author yinpeng
 */
@RestController
@RequestMapping("es")
public class ElasearchController {


	@Autowired
	private EsOperateService esOperateService;

	@GetMapping("exist")
	public boolean existIndex(@RequestParam("indexName") String indexName) {
		try {
			return esOperateService.existIndex(indexName);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return false;
	}
}
